﻿using AutoMapper;
using SIG.Model.Albums;
using SIG.Service;
using SIG.ViewModel.Front.Albums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;

namespace SIG.WebMVC.Controllers
{
    //[RoutePrefix("sample")]
    public class PhotoController : BaseController
    {
        private readonly IPhotoService _photoService;
        private IMapper _mapper;
        public PhotoController(IPhotoService photoService, IMapper mapper)
        {
            _photoService = photoService;
            _mapper = mapper;
        }

        [Route("sample-{albumId}")]
        public async Task<ActionResult> IndexAsync(int albumId)
        {
            var list = await _photoService.GetActiveElementsAync(albumId);
            var vm = _mapper.Map<IList<Photo>, IList<PhotoVM>>(list);
            return View(vm);
        }
        [Route("customer-photos")]
        public async Task<ActionResult> CustomerPhotosAsync()
        {
            var list = await _photoService.GetActiveElementsAync(4);
            var vm = _mapper.Map<IList<Photo>, IList<PhotoVM>>(list);
            return View(vm);
        }
    }
}